{% block content %}
<br />
<div class="infinite-container3">
    {% for news in pageData['newss'] %}
        <div class="infinite-item3">
        <div class="row">
            <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12">
            {% if news.tipo == "eventi" %}
                <div class="panel panel-success">
                    <div class="panel-heading">
                            [{{news.tipo_news}}]<strong>{{news.title}}</strong>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-12 col-lg-12">{{ news.body }}</div>
                         </div>
                    </div>
                    <div class="panel-footer">
                           Del: {{news.publication_date|datetimeformat}} <br />
                    </div>
                </div>
            {% elif news.tipo =="segnalazione" %}
                <div class="panel panel-danger">
                    <div class="panel-heading">
                        [{{news.tipo_segnalazione}}] <strong>{{news.denominazione}} ( #{{ news.numero }} )</strong>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-12 col-lg-12"><b>Tipo:</b> {{ news.tipo_segnalazione }}</div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12 col-lg-12"><b>Priorità:</b> {{ news.priorita_segnalazione }}</div>
                        </div>
                         <div class="row">
                            <div class="col-sm-12 col-lg-12"><b>Stato:</b> {{ news.stato_segnalazione }}</div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12 col-lg-12"><b>Descrizione:</b> {{ news.descrizione }}</div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12 col-lg-12">
    <!--
                                <a href="data:image/png;base64,{{news.immagine_thumb}}" rel="prettyPhoto" title="{{news.denominazione}}">
    -->
                            {% if news.immagine_thumb and news.immagine_thumb != "" %}
                            <img style='max-height: 90%; max-width: 90%' src="data:image/png;base64,{{news.immagine_thumb}}"

                            alt='{{news.denominazione}}' />
                            {% endif %}
    <!--
                            </a>
    -->
                            </div>
                        </div>
                    </div>
                    <div class="panel-footer">
                        {{news.data_inserimento|datetimeformat}}

                            {% if pageData["oper"] %}
                            <a  data-slidepanel="panel" preview="/italiaCives/segnalazione/Preview?id={{news.id}}" href="/italiaCives/segnalazione/Preview?id={{news.id}}" type="button" class="btn pull-right anteprima"><i style="color:#C9302C;margin-top:-15px;" class="fa fa-eye fa-2x"></i></a>
                             {% endif %}                    </div>
                </div>
            {% else %}
                <div class="panel panel-info">
                    <div class="panel-heading">
                            [{{news.tipo_news}}]<strong>{{news.title}}</strong>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-12 col-lg-12">{{ news.body }}</div>
                        </div>
                    </div>
                    <div class="panel-footer">
                                       Del: {{news.publication_date|datetimeformat}} <br />
                    </div>

                </div>
            {% endif %}

            </div>

            </div>
            </div>
    {% endfor %}
{% if pageData['page'] != 0 %}
    <a href="/italiaCives/dashboard_stream/{{pageData['page']}}" class="infinite-more-link3"></a>
{% endif %}
</div>

{% endblock%}
{% block custom_js %}
<script type="text/javascript">
$(document).ready(function () {
  //$("img").unveil();
    //$('.infinite-container3').waypoint('enable');
$('.infinite-container3').waypoint('infinite', {
  container: 'auto',
  items: '.infinite-item3',
  more: '.infinite-more-link3',
  offset: 'bottom-in-view',
  loadingClass: 'infinite-loading',
  onBeforePageLoad: $.noop,
  onAfterPageLoad: function(){ $('[data-slidepanel]').slidepanel({
          orientation: 'right',
          mode: 'push',
      })},
});
$(window).trigger('resize');
$.waypoints('refresh');
$.waypoints('viewportHeight');

//$(".anteprima").click(function(e){
     ////$('html').css('overflow','hidden');
           //// lock scroll position, but retain settings for later
      //var scrollPosition = [
        //self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
        //self.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop
      //];
      //var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
      //html.data('scroll-position', scrollPosition);
      //html.data('previous-overflow', html.css('overflow'));
      //html.css('overflow', 'hidden');
      //window.scrollTo(scrollPosition[0], scrollPosition[1]);

      //});

          $('[data-slidepanel]').slidepanel({
              orientation: 'right',
              mode: 'push',
          });
  //$("a.close").click(function(e){
      ////$('html').css('overflow','scroll');
            //// un-lock scroll position
      //var html = jQuery('html');
      //var scrollPosition = html.data('scroll-position');
      //html.css('overflow', html.data('previous-overflow'));
      //window.scrollTo(scrollPosition[0], scrollPosition[1])

          //});

  $(".cb_slide_panel").swipe( {
//Generic swipe handler for all directions

swipeRight: function() {
//$(this).parent().carousel('next');
//alert("CIAO");
$("a.close").click();
 //$(".cb_slide_panel").empty();

},
//Default is 75px, set to 0 for demo so any distance triggers swipe
threshold:100
});



});
</script>
{% endblock%}
